package base;

/**
 * @Author: DRevelation
 * @Date: 2021/3/3 9:42
 * 内容类型
 */
public enum ContTypeEnum {

    /**
     * 文章
     */
    ARTICLE(1, "文章"),

    /**
     * 图集
     */
    PHOTO(2, "图集"),

    /**
     * 视频
     */
    VIDEO(3, "视频"),

    /**
     * 音频
     */
    AUDIO(4, "音频"),

    /**
     * 专辑
     */
    ALBUM(5, "专辑"),

    /**
     * 专题
     */
    SUBJECT(6, "专题");

    private int index;
    private String name;

    ContTypeEnum(int index, String name) {
        this.index = index;
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public String getName() {
        return name;
    }

    public String getNameByIndex() {
        switch (index) {
            case 1:
                return ContTypeEnum.ARTICLE.name;
            case 2:
                return ContTypeEnum.PHOTO.name;
            case 3:
                return ContTypeEnum.VIDEO.name;
            case 4:
                return ContTypeEnum.AUDIO.name;
            case 5:
                return ContTypeEnum.ALBUM.name;
            case 6:
                return ContTypeEnum.SUBJECT.name;
            default:
                return "";
        }
    }

    public static void main(String[] args) {
        ContTypeEnum contTypeEnum = ContTypeEnum.ALBUM;
        System.out.println(contTypeEnum.getIndex());
        System.out.println(contTypeEnum.getName());

        Long l = 11L;
        System.out.println(l.toString());

        ContTypeEnum contTypeEnum1 = ContTypeEnum.VIDEO;
        String name = contTypeEnum1.getNameByIndex();
        System.out.println("name = " + name);
    }
}
